home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ddevb / dde_vb.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-06  |  20.4 KB  |  636 lines

  1. VERSION 2.00
  2. Begin Form DDE_VB 
  3.    BackColor       =   &H00FFFFFF&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "DDE_VB"
  6.    ClientHeight    =   4950
  7.    ClientLeft      =   1020
  8.    ClientTop       =   2520
  9.    ClientWidth     =   7575
  10.    Height          =   5640
  11.    Icon            =   DDE_VB.FRX:0000
  12.    Left            =   960
  13.    LinkMode        =   1  'Source
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    ScaleHeight     =   4950
  17.    ScaleWidth      =   7575
  18.    Top             =   1890
  19.    Width           =   7695
  20.    Begin TextBox tbStatus 
  21.       FontBold        =   -1  'True
  22.       FontItalic      =   -1  'True
  23.       FontName        =   "MS Sans Serif"
  24.       FontSize        =   8.25
  25.       FontStrikethru  =   0   'False
  26.       FontUnderline   =   0   'False
  27.       Height          =   360
  28.       Left            =   0
  29.       TabIndex        =   14
  30.       Top             =   4608
  31.       Width           =   7596
  32.    End
  33.    Begin CommandButton cmClipboard 
  34.       Caption         =   "Clipboard"
  35.       Height          =   276
  36.       Left            =   6240
  37.       TabIndex        =   17
  38.       Top             =   4128
  39.       Width           =   1236
  40.    End
  41.    Begin TextBox tbDDE 
  42.       Height          =   372
  43.       Left            =   6240
  44.       MultiLine       =   -1  'True
  45.       TabIndex        =   12
  46.       Top             =   2208
  47.       Visible         =   0   'False
  48.       Width           =   1236
  49.    End
  50.    Begin TextBox tbText 
  51.       Height          =   2220
  52.       Left            =   96
  53.       MultiLine       =   -1  'True
  54.       ScrollBars      =   2  'Vertical
  55.       TabIndex        =   13
  56.       Top             =   2208
  57.       Width           =   6036
  58.    End
  59.    Begin CommandButton cmPoke 
  60.       Caption         =   "Poke"
  61.       Height          =   276
  62.       Left            =   6240
  63.       TabIndex        =   16
  64.       Top             =   1728
  65.       Width           =   1236
  66.    End
  67.    Begin ComboBox cbPoke 
  68.       Height          =   288
  69.       Left            =   96
  70.       TabIndex        =   15
  71.       Top             =   1728
  72.       Width           =   6036
  73.    End
  74.    Begin CommandButton cmExecute 
  75.       Caption         =   "Execute"
  76.       Enabled         =   0   'False
  77.       Height          =   276
  78.       Left            =   6240
  79.       TabIndex        =   9
  80.       Top             =   1344
  81.       Width           =   1236
  82.    End
  83.    Begin ComboBox cbExecute 
  84.       Enabled         =   0   'False
  85.       Height          =   288
  86.       Left            =   96
  87.       TabIndex        =   3
  88.       Top             =   1344
  89.       Width           =   6036
  90.    End
  91.    Begin CommandButton cmDisconnect 
  92.       Caption         =   "Disconnect"
  93.       Height          =   276
  94.       Left            =   6240
  95.       TabIndex        =   5
  96.       Top             =   864
  97.       Visible         =   0   'False
  98.       Width           =   1236
  99.    End
  100.    Begin TextBox tbError 
  101.       ForeColor       =   &H00000080&
  102.       Height          =   300
  103.       Left            =   100
  104.       TabIndex        =   11
  105.       Top             =   888
  106.       Width           =   5676
  107.    End
  108.    Begin CommandButton cmRequest 
  109.       Caption         =   "Request"
  110.       Enabled         =   0   'False
  111.       Height          =   276
  112.       Left            =   6240
  113.       TabIndex        =   10
  114.       Top             =   576
  115.       Width           =   1236
  116.    End
  117.    Begin ComboBox cbDDE_Item 
  118.       BackColor       =   &H00FFFFFF&
  119.       Enabled         =   0   'False
  120.       Height          =   288
  121.       Left            =   3600
  122.       TabIndex        =   2
  123.       Top             =   600
  124.       Width           =   2556
  125.    End
  126.    Begin ComboBox cbDDE_Topic 
  127.       BackColor       =   &H00FFFFFF&
  128.       Enabled         =   0   'False
  129.       Height          =   288
  130.       Left            =   1920
  131.       TabIndex        =   1
  132.       Top             =   600
  133.       Width           =   1572
  134.    End
  135.    Begin ComboBox cbDDE_App 
  136.       BackColor       =   &H00FFFFFF&
  137.       Height          =   288
  138.       Left            =   100
  139.       TabIndex        =   0
  140.       Top             =   600
  141.       Width           =   1692
  142.    End
  143.    Begin CommandButton cmQuit 
  144.       Caption         =   "Quit"
  145.       Height          =   276
  146.       Left            =   6240
  147.       TabIndex        =   4
  148.       Top             =   96
  149.       Width           =   1236
  150.    End
  151.    Begin Label txItem 
  152.       BackColor       =   &H00FFFFFF&
  153.       Caption         =   "Item"
  154.       Height          =   255
  155.       Left            =   3600
  156.       TabIndex        =   8
  157.       Top             =   360
  158.       Width           =   1095
  159.    End
  160.    Begin Label txTopic 
  161.       BackColor       =   &H00FFFFFF&
  162.       Caption         =   "Topic"
  163.       Height          =   255
  164.       Left            =   1920
  165.       TabIndex        =   7
  166.       Top             =   360
  167.       Width           =   1095
  168.    End
  169.    Begin Label txApplication 
  170.       BackColor       =   &H00FFFFFF&
  171.       Caption         =   "Application"
  172.       Height          =   255
  173.       Left            =   100
  174.       TabIndex        =   6
  175.       Top             =   360
  176.       Width           =   1335
  177.    End
  178.    Begin Menu mnFile 
  179.       Caption         =   "&File"
  180.       Begin Menu miFileEdit 
  181.          Caption         =   "&Edit INI File"
  182.       End
  183.       Begin Menu miFileExit 
  184.          Caption         =   "E&xit"
  185.       End
  186.    End
  187.    Begin Menu mnSave 
  188.       Caption         =   "&Save"
  189.       Index           =   0
  190.       Begin Menu miSaveApp 
  191.          Caption         =   "&Application"
  192.       End
  193.       Begin Menu miSaveTopic 
  194.          Caption         =   "&Topic"
  195.       End
  196.       Begin Menu miSaveItem 
  197.          Caption         =   "&Item"
  198.       End
  199.       Begin Menu miBar1 
  200.          Caption         =   "-"
  201.       End
  202.       Begin Menu miSaveExecute 
  203.          Caption         =   "&Execute"
  204.       End
  205.       Begin Menu miBar2 
  206.          Caption         =   "-"
  207.       End
  208.       Begin Menu miSavePoke 
  209.          Caption         =   "&Poke"
  210.       End
  211.    End
  212.    Begin Menu mnHelp 
  213.       Caption         =   "&Help"
  214.       Begin Menu miHelpAbout 
  215.          Caption         =   "&About"
  216.       End
  217.    End
  218. DefInt A-X
  219. Const NO_APP = 282
  220. Const MULTIPLE_APPS = 283
  221. Const WRONG_DATA_TYPE = 285
  222. Const WM_USER = &H400
  223. Const LB_RESETCONTENT = WM_USER + 5
  224. Const CB_RESETCONTENT = WM_USER + 11
  225. Dim DDEApp As String
  226. Dim DDETopic As String
  227. Dim DDEItem As String
  228. Dim ValidLink As Integer
  229. Dim app As String * 100
  230. Dim exec As String * 200
  231. Dim item As String * 100
  232. Dim Topic As String * 100
  233. Dim clipname As String * 40
  234. Const INIFILE$ = "DDE_VB.INI"
  235. Const INI_APPS$ = "Applications"
  236. Dim HelpFilePath$
  237. Dim CR$
  238. Dim LF$
  239. Dim NL$
  240. Dim TB$
  241. Sub cbDDE_App_Change ()
  242.     cbDDE_Topic.Enabled = True
  243.     cbDDE_Topic.text = ""
  244.     cbDDE_Item.Enabled = False
  245.     cbDDE_Item.text = ""
  246.     cmDisconnect_click
  247. End Sub
  248. Sub cbDDE_App_DropDown ()
  249.     ClearComboBox cbDDE_App
  250.     Count% = GetPrivateProfileInt("Applications", "Apps", 0, INIFILE$)
  251.     ReDim arIniApps(Count%)
  252.     For i% = 1 To Count%
  253.         zBuff% = GetPrivateProfileString("Applications", "App" + LTrim$(Str$(i%)), "none", app, 255, INIFILE$)
  254.         arIniApps(i% - 1).AppName = LTrim$(RTrim$(Left$(app, zBuff%)))
  255.         cbDDE_App.AddItem arIniApps(i% - 1).AppName
  256.     Next
  257.     cbDDE_Topic.Enabled = True
  258.     cbDDE_Topic.text = ""
  259.     cbDDE_Item.Enabled = False
  260.     cbDDE_Item.text = ""
  261. End Sub
  262. Sub cbDDE_App_GotFocus ()
  263.     tbStatus.text = "Select / Enter Application name to connect to..."
  264. End Sub
  265. Sub cbDDE_App_LostFocus ()
  266.     tbStatus.text = ""
  267. End Sub
  268. Sub cbDDE_Item_DropDown ()
  269.     ClearComboBox cbDDE_Item
  270.     cmRequest.Enabled = True
  271.     Topic = cbDDE_Topic.text
  272.     Count2% = GetPrivateProfileInt(app, "Items", 0, INIFILE$)
  273.     ReDim arItems(Count2%)
  274.     For ii% = 1 To Count2%
  275.         zBuff% = GetPrivateProfileString(app, "Item" + LTrim$(Str$(ii%)), "none", item, 255, INIFILE$)
  276.         arItems(ii% - 1).item = LTrim$(RTrim$(Left$(item, zBuff%)))
  277.         cbDDE_Item.AddItem arItems(ii% - 1).item
  278.     Next
  279. End Sub
  280. Sub cbDDE_Item_GotFocus ()
  281.     tbStatus.text = "Select / Enter the Item to get (cannot be blank)..."
  282. End Sub
  283. Sub cbDDE_Item_LostFocus ()
  284.     tbStatus.text = ""
  285. End Sub
  286. Sub cbDDE_Topic_Change ()
  287.     cbDDE_Item.Enabled = True
  288.     cmRequest.Enabled = True
  289. End Sub
  290. Sub cbDDE_Topic_DropDown ()
  291.     ClearComboBox cbDDE_Topic
  292.     cbDDE_Item.Enabled = True
  293.     cmRequest.Enabled = True
  294.     app = cbDDE_App.text
  295.     Count2% = GetPrivateProfileInt(app, "Topics", 0, INIFILE$)
  296.     ReDim arTopics(Count2%)
  297.     For i% = 1 To Count2%
  298.         zBuff% = GetPrivateProfileString(app, "Topic" + LTrim$(Str$(i%)), "none", Topic, 255, INIFILE$)
  299.         arTopics(i% - 1).Topic = LTrim$(RTrim$(Left$(Topic, zBuff%)))
  300.         cbDDE_Topic.AddItem arTopics(i% - 1).Topic
  301.     Next
  302. End Sub
  303. Sub cbDDE_Topic_GotFocus ()
  304.     tbStatus.text = "Select / Enter Topic name (e.g. SYSTEM)..."
  305. End Sub
  306. Sub cbDDE_Topic_LostFocus ()
  307.     tbStatus.text = ""
  308. End Sub
  309. Sub cbExecute_DropDown ()
  310.     ClearComboBox cbExecute
  311.     app = cbDDE_App.text
  312.     Count% = GetPrivateProfileInt(app, "Executes", 0, INIFILE$)
  313.     ReDim arExecutes(Count%)
  314.     For i% = 1 To Count%
  315.         zBuff% = GetPrivateProfileString(app, "Execute" + LTrim$(Str$(i%)), "none", exec, 255, INIFILE$)
  316.         arExecutes(i% - 1).Instruction = LTrim$(RTrim$(Left$(exec, zBuff%)))
  317.         cbExecute.AddItem arExecutes(i% - 1).Instruction
  318.     Next
  319.         
  320. End Sub
  321. Sub cbPoke_DropDown ()
  322.     ClearComboBox cbPoke
  323.     app = cbDDE_App.text
  324.     Count% = GetPrivateProfileInt(app, "Pokes", 0, INIFILE$)
  325.     ReDim arPokes(Count%)
  326.     For i% = 1 To Count%
  327.         zBuff% = GetPrivateProfileString(app, "Poke" + LTrim$(Str$(i%)), "none", exec, 255, INIFILE$)
  328.         arPokes(i% - 1).Instruction = LTrim$(RTrim$(Left$(exec, zBuff%)))
  329.         cbPoke.AddItem arPokes(i% - 1).Instruction
  330.     Next
  331. End Sub
  332. Sub ClearComboBox (ctrl As Control)
  333.     temp$ = ctrl.text
  334.     hWndOld% = GetFocus()
  335.     hWindow% = GetParent(GetFocus())
  336.     x% = SendMessage(hWindow%, CB_RESETCONTENT, 0, 0)
  337.     x% = PutFocus(hWndOld%)
  338.     ctrl.text = temp$
  339. End Sub
  340. Sub ClearListBox (ctrl As Control)
  341.   hWndOld% = GetFocus()
  342.   ctrl.SetFocus
  343.   x = SendMessage(GetFocus(), LB_RESETCONTENT, 0, 0)
  344.   Suc% = PutFocus(hWndOld%)
  345. End Sub
  346. Sub cmClipboard_Click ()
  347.     handle% = DDE_VB.hWnd
  348.     x% = OpenClipboard(handle%)
  349.     c% = CountClipboardFormats()
  350.     z% = 0
  351.     clipname = ""
  352.     tbText.text = "CountClipboardFormats =" + Str$(c%) + NL$ + NL$
  353.     For i% = 1 To c%
  354.         z% = EnumClipboardFormats(z%)
  355.         y% = GetClipboardFormatName(z%, clipname, Len(clipname))
  356.         Select Case z%
  357.             Case -16369 To -12289 ' "Private" formats &H200 to &H2FF
  358.                 clipname = "(Private)" + TB$ + Left$(clipname, InStr(clipname, Chr$(0)) - 1)
  359.             Case -12273 To -8193  ' "GDIOBJ" formats  &H300 to &H3FF
  360.                 clipname = "(GDIOBJ)" + TB$ + Left$(clipname, InStr(clipname, Chr$(0)) - 1)
  361.             Case 1                ' CF_TEXT
  362.                 clipname = "(Built In)" + TB$ + "CF_TEXT"
  363.             Case 2                ' CF_BITMAP
  364.                 clipname = "(Built In)" + TB$ + "CF_BITMAP"
  365.             Case 3                ' CF_METAFILE
  366.                 clipname = "(Built In)" + TB$ + "CF_METAFILE"
  367.             Case 4                ' CF_SYLK
  368.                 clipname = "(Built In)" + TB$ + "CF_SYLK"
  369.             Case 5                ' CF_DIF
  370.                 clipname = "(Built In)" + TB$ + "CF_DIF"
  371.             Case 6                ' CF_TIFF
  372.                 clipname = "(Built In)" + TB$ + "CF_TIFF"
  373.             Case 7                ' CF_OEMTEXT
  374.                 clipname = "(Built In)" + TB$ + "CF_OEMTEXT"
  375.             Case 8                ' CF_DIB
  376.                 clipname = "(Built In)" + TB$ + "CF_DIB"
  377.             Case 9                ' CF_PALETTE
  378.                 clipname = "(Built In)" + TB$ + "CF_DIB"
  379.             Case 128              ' CF_OWNERDISPLAY = &H80
  380.                 clipname = "(Built In)" + TB$ + "CF_OWNERDISPLAY"
  381.             Case 129              ' CF_DSPTEXT = &H81
  382.                 clipname = "(Built In)" + TB$ + "CF_DSPTEXT"
  383.             Case 130              ' CF_DSPBITMAP = &H82
  384.                 clipname = "(Built In)" + TB$ + "CF_DSPBITMAP"
  385.             Case 131              ' CF_DSPMETAFILEPICT = &H83
  386.                 clipname = "(Built In)" + TB$ + "CF_DSPMETAFILEPICT"
  387.             Case Else
  388.                 clipname = "(Unknown)"
  389.         End Select
  390.         tbText.text = tbText.text + Str$(z%) + TB$ + clipname + NL$
  391.     Next
  392.     x% = CloseClipboard()
  393. End Sub
  394. Sub cmDisconnect_click ()
  395.     MousePointer = 11
  396.     On Error GoTo cmDisconnectError
  397.     tbDDE.LinkMode = NONE
  398.     tbError.text = ""
  399.     tbText.text = ""
  400.     cbExecute.text = ""
  401.     cbPoke.text = ""
  402.     cmRequest.Caption = "Connect"
  403.     cmDisconnect.Visible = False
  404.     cmRequest.Enabled = False
  405.     cmExecute.Enabled = False
  406.     cbExecute.Enabled = False
  407.     cmPoke.Enabled = False
  408.     cbPoke.Enabled = False
  409.     MousePointer = 0
  410.     Exit Sub
  411. cmDisconnectError:
  412.     Call DDE_Error(Err)
  413.     Resume
  414. End Sub
  415. Sub cmExecute_Click ()
  416.     On Error GoTo cmExecuteError
  417.     tbError.text = ""
  418.     tbDDE.LinkExecute cbExecute.text
  419.     Exit Sub
  420. cmExecuteError:
  421.     Call DDE_Error(Err)
  422.     Exit Sub
  423. End Sub
  424. Sub cmPoke_Click ()
  425.     On Error GoTo cmPokeError
  426.     tbError.text = ""
  427.     tbDDE.text = cbPoke.text
  428.     tbDDE.LinkPoke
  429.     Exit Sub
  430. cmPokeError:
  431.     Call DDE_Error(Err)
  432.     Exit Sub
  433. End Sub
  434. Sub CmQuit_Click ()
  435.     MousePointer = 11
  436.     On Error GoTo cmQuitError
  437.     tbDDE.LinkMode = NONE
  438.     Unload DDE_VB
  439.     End
  440.     Exit Sub
  441. cmQuitError:
  442.     Call DDE_Error(Err)
  443.     Resume
  444. End Sub
  445. Sub cmReqSave_Click ()
  446.     ' Check for valid link first
  447.     ' If App doesn't exist in array then
  448.         ' Add to Apps
  449.     ' If Topic doesn't exist in array then
  450.         ' Add to Topics
  451.     ' If Item doesn't exist in array then
  452.         ' Add to Items
  453.     ReDim arIniApps(Count%)
  454.     For i% = 1 To Count%
  455.         zBuff% = GetPrivateProfileString("Applications", "App" + LTrim$(Str$(i%)), "none", app, 255, INIFILE$)
  456.         arIniApps(i% - 1).AppName = LTrim$(RTrim$(Left$(app, zBuff%)))
  457.         cbDDE_App.AddItem arIniApps(i% - 1).AppName
  458.     Next
  459.     Count% = GetPrivateProfileInt("Applications", "Apps", 0, INIFILE$) + 1
  460.     action% = WritePrivateProfileString("Applications", "Apps", Str$(Count%), INIFILE$)
  461.     sBuff$ = cbDDE_App.text
  462.     zBuff% = WritePrivateProfileString("Applications", "App" + LTrim$(Str$(Count%)), sBuff$, INIFILE$)
  463.     Count2% = GetPrivateProfileInt(app, "Topics", 0, INIFILE$)
  464.     ReDim arTopics(Count2%)
  465.     For i% = 1 To Count2%
  466.         zBuff% = GetPrivateProfileString(app, "Topic" + LTrim$(Str$(i%)), "none", Topic, 255, INIFILE$)
  467.         arTopics(i% - 1).Topic = LTrim$(RTrim$(Left$(Topic, zBuff%)))
  468.         cbDDE_Topic.AddItem arTopics(i% - 1).Topic
  469.     Next
  470. End Sub
  471. Sub CmRequest_Click ()
  472. Dim ErrReq As Integer
  473.     On Error GoTo cmRequestError
  474.     tbError.text = ""
  475.     Select Case cmRequest.Caption
  476.         Case "Connect"
  477.             DDEApp = cbDDE_App.text
  478.             DDETopic = cbDDE_Topic.text
  479.             DDEItem = cbDDE_Item.text
  480.             MakeLink ValidLink, tbDDE, DDEApp, DDETopic, DDEItem
  481.             Select Case ValidLink
  482.                 Case True
  483.                 Case False
  484.                     Exit Sub
  485.             End Select
  486.             cmRequest.Caption = "Request"
  487.             cmDisconnect.Visible = True
  488.             cmExecute.Enabled = True
  489.             cbExecute.Enabled = True
  490.             cmPoke.Enabled = True
  491.             cbPoke.Enabled = True
  492.         Case "Request"
  493.             tbDDE.LinkItem = cbDDE_Item.text
  494.             tbDDE.LinkRequest
  495.             StuffBox tbText, tbDDE
  496.         Case Else
  497.     End Select
  498.     Exit Sub
  499. cmRequestError:
  500.     Call DDE_Error(Err)
  501.     Exit Sub
  502. End Sub
  503. Sub DDE_Error (errVal)
  504.     ErrReq = errVal
  505.     DDE_VB.tbError.text = DecodeError(ErrReq)
  506.     tbError.Refresh
  507. End Sub
  508. Sub Form_Load ()
  509.     Initialize
  510.     cmExecute.Enabled = False
  511.     cbExecute.Enabled = False
  512.     cmPoke.Enabled = False
  513.     cbPoke.Enabled = False
  514.     cmRequest.Caption = "Connect"
  515.     FilePath$ = Space$(128)
  516.     hModule% = GetClassWord(hWnd, GCW_HMODULE)
  517.     zBuff% = GetModuleFileName(hModule%, FilePath$, 127)
  518.     sBuff$ = Left$(FilePath$, z%)
  519. End Sub
  520. Sub Initialize ()
  521.     ' Set general constants that cannot be declared:
  522.     CR$ = Chr$(13)
  523.     LF$ = Chr$(10)
  524.     NL$ = Chr$(13) + Chr$(10)
  525.     TB$ = Chr$(9)
  526. End Sub
  527. Sub MakeLink (Link As Integer, Window As Control, app As String, Topic As String, item As String)
  528. Dim msg As String
  529. Dim handle As Long
  530. Dim ErrCon As Integer
  531.     On Error GoTo MakeLinkError
  532.     handle = GetModuleHandle(UCase$(app + ".EXE"))
  533.     While GetModuleHandle(UCase$(app + ".EXE")) = 0
  534.         msg = "No application responded to DDE initiate.  Attempt to start " + app + " ?"
  535.         If MsgBox(msg, MB_ICONQUESTION + MB_OKCANCEL) = IDOK Then
  536.             Link = Shell(app + ".EXE")
  537.         Else
  538.             Link = USER_CANCELED
  539.             Exit Sub
  540.         End If
  541.     Wend
  542.     'While GetModuleUsage(handle) > 1
  543.         ' Multiple apps running
  544.     'Wend
  545.     Window.LinkTopic = app + "|" + Topic
  546.     Window.LinkItem = item
  547.     Window.LinkMode = COLD
  548.     Window.LinkRequest
  549.     StuffBox tbText, tbDDE
  550.     Link = True
  551.     'Select Case ValidLink
  552.     '    Case SUCCESS
  553.     '        CmConnect.Caption = "&Disconnect"
  554.     '        ValidLink = True
  555.     '        tbDDE.Visible = True
  556.     '        tbDDE.LinkRequest
  557.     '    Case USER_CANCELED, NO_APP, MULTIPLE_APPS
  558.     '        BreakLink
  559.     '        Exit Sub
  560.     '    Case Else
  561.     '        Stop
  562.     'End Select
  563.     Exit Sub
  564. MakeLinkError:
  565.     Call DDE_Error(Err)
  566.     Exit Sub
  567. End Sub
  568. Sub miFileEdit_Click ()
  569.     run = Shell("NOTEPAD C:\WINDOWS\DDE_VB.INI", 1)
  570. End Sub
  571. Sub miFileExit_Click ()
  572.     MousePointer = 11
  573.     On Error GoTo miFileExitError
  574.     tbDDE.LinkMode = NONE
  575.     Unload DDE_VB
  576.     End
  577.     Exit Sub
  578. miFileExitError:
  579.     Call DDE_Error(Err)
  580.     Resume
  581. End Sub
  582. Sub miHelpAbout_Click ()
  583.     AboutForm.Show
  584. End Sub
  585. Sub miSaveApp_Click ()
  586.     Count% = GetPrivateProfileInt("Applications", "Apps", 0, INIFILE$) + 1
  587.     action% = WritePrivateProfileString("Applications", "Apps", Str$(Count%), INIFILE$)
  588.     sBuff$ = cbDDE_App.text
  589.     zBuff% = WritePrivateProfileString("Applications", "App" + LTrim$(Str$(Count%)), sBuff$, INIFILE$)
  590. End Sub
  591. Sub miSaveExecute_Click ()
  592.     app = cbDDE_App.text
  593.     Count% = GetPrivateProfileInt(app, "Executes", 0, INIFILE$) + 1
  594.     action% = WritePrivateProfileString(app, "Executes", Str$(Count%), INIFILE$)
  595.     sBuff$ = cbExecute.text
  596.     action% = WritePrivateProfileString(app, "Execute" + LTrim$(Str$(Count%)), sBuff$, INIFILE$)
  597. End Sub
  598. Sub miSaveItem_Click ()
  599.     app = cbDDE_App.text
  600.     Count% = GetPrivateProfileInt(app, "Items", 0, INIFILE$) + 1
  601.     action% = WritePrivateProfileString(app, "Items", Str$(Count%), INIFILE$)
  602.     sBuff$ = cbDDE_Item.text
  603.     action% = WritePrivateProfileString(app, "Item" + LTrim$(Str$(Count%)), sBuff$, INIFILE$)
  604. End Sub
  605. Sub miSavePoke_Click ()
  606.     app = cbDDE_App.text
  607.     Count% = GetPrivateProfileInt(app, "Pokes", 0, INIFILE$) + 1
  608.     action% = WritePrivateProfileString(app, "Pokes", Str$(Count%), INIFILE$)
  609.     sBuff$ = cbPoke.text
  610.     action% = WritePrivateProfileString(app, "Poke" + LTrim$(Str$(Count%)), sBuff$, INIFILE$)
  611. End Sub
  612. Sub miSaveTopic_Click ()
  613.     app = cbDDE_App.text
  614.     Count% = GetPrivateProfileInt(app, "Topics", 0, INIFILE$) + 1
  615.     action% = WritePrivateProfileString(app, "Topics", Str$(Count%), INIFILE$)
  616.     sBuff$ = cbDDE_Topic.text
  617.     action% = WritePrivateProfileString(app, "Topic" + LTrim$(Str$(Count%)), sBuff$, INIFILE$)
  618. End Sub
  619. Sub StuffBox (tbText As Control, tbDDE As Control)
  620. Dim sBuff As String * 250
  621. b% = 1
  622. If InStr(tbDDE.text, LF$) = 0 Then
  623.     For x% = 1 To Len(tbDDE.text)
  624.         If Mid$(tbDDE.text, x%, 1) = TB$ Then
  625.             Mid$(sBuff, b%, 2) = NL$
  626.             b% = b% + 1
  627.         Else
  628.             Mid$(sBuff, b%, 1) = Mid$(tbDDE.text, x%, 1)
  629.         End If
  630.         b% = b% + 1
  631.     Next
  632.     tbText.text = sBuff
  633.     tbText.text = tbDDE.text
  634. End If
  635. End Sub
  636.